<template>
  <div class="example-container" v-if="showList">
    <div class="title">{{ props.title }}</div>
    <div class="subTitle">{{ props.subTitle }}</div>
    <div class="example-list">
      <!-- 智能问答 -->
      <div v-if="props.isQuestion" class="question-container">
        <div class="tool-container flex-item">
          <img class="vetor" src="../../../assets/chat/vector.png" alt="" />
          <div class="tool-title">效率工具</div>
          <div class="tool-subtitle">不良资产法律问题，一触即答，智慧法律助手，让工作更简单</div>
          <div class="tool-first tool-item">
            <div>
              <img class="tool-img" src="../../../assets/chat/tool1.png" alt="" />
            </div>
            <div class="item-main">
              <div class="tool-item-title">即时响应，高效便捷</div>
              <div class="tool-item-content">智能问答系统能够即时响应用户的法律问题，随时随地获取即时的法律解答</div>
            </div>
          </div>
          <div class="tool-second tool-item">
            <div>
              <img class="tool-img" src="../../../assets/chat/tool2.png" alt="" />
            </div>
            <div class="item-main">
              <div class="tool-item-title">精准理解，专业解答</div>
              <div class="tool-item-content">准确理解用户的问题意图，并提供专业、准确的法律解答</div>
            </div>
          </div>
        </div>
        <div class="question-list flex-item">
          <div class="question-title">热门问题</div>
          <div class="question-box">
            <div class="question-item" v-for="(item, index) in props.questionList" :key="index" @click="askFn(item)">
              <div
                class="item-index"
                :style="{ color: index === 0 || index === 1 ? '#eb2f2f' : index === 2 ? '#fd7b3f' : '#c8cad9' }"
              >
                {{ index + 1 }}
              </div>
              <div class="item-content">{{ item }}</div>
              <!-- <el-tooltip class="box-item" effect="dark" :content="item" placement="top">
                <div class="item-content">{{ item }}</div>
              </el-tooltip> -->
            </div>
          </div>
        </div>
      </div>
      <!-- 尽调报告 -->
      <div v-else class="report-container">
        <!-- <ReportInput ref="reportInputRef" :isIndex="true" :isLoading="false" @generateReport="generateReportFn" /> -->
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import ReportInput from "../../report/components/reportInput.vue"
import { ref } from "vue"
import emitter from "../../../utils/eventBus"
type PropType = {
  title?: string
  subTitle?: string
  questionList?: string[]
  isQuestion?: boolean
  showList?: boolean
}
const props = withDefaults(defineProps<PropType>(), {
  title: "你好，我是师爷",
  subTitle: "不良资产领域专业问题解答",
  isQuestion: true,
  showList: true
})

const emits = defineEmits(["askFn", "generateReport", "setTabActive"])
const askFn = (question: string) => {
  emitter.emit("custom-event", { data: true })
  emits("askFn", question)
}
const generateReportFn = (question: string) => {
  emits("generateReport", question)
}
const reportInputRef = ref()
const setTabActive = (id: number) => {
  reportInputRef.value.setTabActive(id)
}

defineExpose({ setTabActive })
</script>
<style scoped lang="scss">
.example-container {
  margin-top: 70px;
  width: 100%;
  text-align: center;
  .title {
    color: #333;
    font-family: "PingFang SC";
    font-size: 28px;
    font-style: normal;
    font-weight: 500;
    line-height: 24px;
  }
  .subTitle {
    color: #5f6387;
    text-align: center;
    font-family: "PingFang SC";
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 24px;
    margin-top: 15px;
  }
  .example-list {
    text-align: left;
    margin: 60px 0 50px;
    .question-container {
      display: flex;
      height: 319px;
      justify-content: center;
      position: relative;
      .vetor {
        position: absolute;
        left: 119px;
        top: -60px;
        width: 135px;
        height: 195px;
      }
      .flex-item {
        width: 465px;
        height: 100%;
        border-radius: 15px;
      }
      .tool-container {
        margin-right: 20px;
        padding: 30px;
        border: 2px solid #fff;
        background: linear-gradient(191deg, #d8e0fe -0.55%, #eef1fc 38.9%, #d2ecfb 101.17%);
        .tool-title {
          color: #333;
          text-align: center;
          font-family: "PingFang SC";
          font-size: 24px;
          font-style: normal;
          font-weight: 500;
          line-height: 22.068px;
        }
        .tool-subtitle {
          color: #757575;
          text-align: center;
          font-family: "PingFang SC";
          font-size: 12px;
          font-style: normal;
          font-weight: 400;
          line-height: 14px;
          margin-top: 10px;
        }
        .tool-item {
          width: 100%;
          background-color: rgba(255, 255, 255, 0.7);
          padding: 10px 15px;
          border-radius: 10px;
          display: flex;
          align-items: center;
          .tool-img {
            width: 50px;
            height: 50px;
          }
          .item-main {
            margin-left: 10px;
            .tool-item-title {
              color: #333;
              font-family: "PingFang SC";
              font-size: 14px;
              font-style: normal;
              font-weight: 500;
              line-height: 18.39px;
              margin-bottom: 3px;
            }
            .tool-item-content {
              color: #333;
              font-family: "PingFang SC";
              font-size: 12px;
              font-style: normal;
              font-weight: 400;
              line-height: 20px;
            }
          }
        }
        .tool-first {
          margin: 30px 0 20px;
        }
        .tool-second {
        }
      }
      .question-list {
        padding: 20px 30px;
        background: url("../../../assets/chat/bgc.png") no-repeat center center;
        background-size: cover;
        .question-title {
          color: #333;
          font-family: "PingFang SC";
          font-size: 24px;
          font-style: normal;
          font-weight: 500;
          line-height: 32px;
        }
        .question-box {
          width: 100%;
          margin-top: 15px;
          .question-item {
            display: flex;
            align-items: center;
            margin-bottom: 10px;
            cursor: pointer;
            .item-index {
              font-size: 20px;
              margin-right: 10px;
              font-style: italic;
            }
            .item-content {
              color: #333;
              font-family: "PingFang SC";
              font-size: 14px;
              font-style: normal;
              font-weight: 400;
              line-height: 39px;
              overflow: hidden;
              white-space: nowrap;
              text-overflow: ellipsis;
              &:hover {
                font-weight: 500;
                color: #4d79ff;
              }
            }
          }
        }
      }
    }
    .report-container {
      width: 1200px;

      .tab-row {
        display: flex;
        width: 1020px;
        margin: 0 auto;
        .tab-item {
          color: #333;
          text-align: center;
          font-family: "PingFang SC";
          font-size: 14px;
          font-style: normal;
          font-weight: 600;
          line-height: 14px;
          border-radius: 23px;
          padding: 9px 14px;
          border: 1px solid #fff;
          background-color: #fff;
          margin-right: 10px;
          display: flex;
          justify-content: center;
          cursor: pointer;
          .svg-img {
            color: #4672ff;
            margin-right: 5px;
          }
        }
        .tab-item:nth-child(2) {
          .svg-img {
            color: #ff9646;
            margin-right: 5px;
          }
        }
        .tab-item:nth-child(3) {
          .svg-img {
            color: #00ad65;
            margin-right: 5px;
          }
        }
        .tab-item:nth-child(4) {
          .svg-img {
            color: #f04040;
            margin-right: 5px;
          }
        }
        .tab-item-active {
          background-color: #4672ff;
          color: #fff;
          border-color: #4672ff;
          .svg-img {
            color: #fff !important;
            margin-right: 5px;
          }
        }
      }

      .input-row {
        width: 1020px;
        margin: 10px auto 15px;
        position: relative;
        .input {
          height: 104px;
          padding: 18px 30px 18px 20px;
          box-sizing: border-box;
          border-radius: 14px;
          box-shadow: 14px 27px 45px 0px rgba(112, 144, 176, 0.2);
          background-color: #fff;
          .input-content {
            display: flex;
            align-items: center;
            white-space: nowrap;
            font-size: 14px;
            font-style: normal;
            line-height: 14px;
            .report-input {
              min-width: 100px;
              text-align: center;
              :deep(.el-input__wrapper) {
                box-shadow: none;
              }
              :deep(.el-input__inner) {
                color: #4672ff;
                font-size: 14px;
                font-style: normal;
                font-weight: 600;
                line-height: 14px;
              }
              :deep(.el-input__inner::placeholder) {
                color: #a8bdff;
                text-align: center;
              }
            }
          }
          .question-input {
            :deep(.el-textarea__inner) {
              box-shadow: none;
            }
            :deep(.el-textarea__inner::placeholder) {
              color: #333;
              font-family: "PingFang SC";
              font-size: 14px;
              font-style: normal;
              font-weight: 400;
              line-height: 14px;
            }
          }
        }

        .icon-container {
          position: absolute;
          right: 10px;
          bottom: 0px;
          z-index: 999;
          .loading-icon {
            width: 32px;
            height: 32px;
          }
          .send-icon {
            width: 32px;
            height: 32px;
          }
        }
      }
      .example-row {
        width: 1020px;
        margin: 0 auto;
        .example-title {
          color: #333;
          font-family: "PingFang SC";
          font-size: 16px;
          font-style: normal;
          font-weight: 600;
          line-height: 24px;
        }
        .example-list-container {
        }
        .guzhi-container {
          .example-item {
            color: #333;
            font-family: "PingFang SC";
            font-size: 14px;
            font-style: normal;
            font-weight: 500;
            line-height: 19px;
            margin-top: 13px;
            cursor: pointer;
            .huati-img {
              width: 14px;
              height: 14px;
            }
          }
        }
        .service-container {
          display: flex;
          .example-item {
            margin: 10px 15px 0 0;
            padding: 13px 15px;
            border-radius: 10px;
            border: 1px solid transparent;
            background: #fff;
            cursor: pointer;
            box-shadow: 0px 2px 9.7px 0px rgba(70, 114, 255, 0.2);
            &:hover {
              border-color: rgba(70, 114, 255, 0.54);
            }
            .huati-img {
              width: 14px;
              height: 14px;
            }
          }
        }
      }
    }
  }
}
</style>
